<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .container {
            display: grid;
            /* grid-template-columns: 100px 100px 100px; */
            /* grid-template-columns: repeat(3, 33.33%); */
            grid-template-columns: repeat(auto-fill, 100px);
            grid-template-rows: 100px;
        }
        .item {
            text-align: center;
            line-height:100px;
            background: gray;
            border: 1px solid #fff;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="item"><p>1</p></div>
        <div class="item"><p>2</p></div>
        <div class="item"><p>3</p></div>
        <div class="item"><p>4</p></div>
        <div class="item"><p>5</p></div>
        <div class="item"><p>6</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
        <div class="item"><p>7</p></div>
    </div>
</body>
</html>